﻿using Castle.DynamicProxy;

// ReSharper disable CheckNamespace

namespace Framework.Core.Notification
// ReSharper restore CheckNamespace
{
    public static class NotificationExtension
    {
        private static readonly ProxyGenerator ProxyGenerator = new ProxyGenerator();

        public static T AsObservable<T>(this T instance)
            where T : class
        {
            return ProxyGenerator.CreateClassProxyWithTarget(instance, new AutoNotifyPropertyChanged());
        }
    }
}